<template>
  <div>
    <div class="header">
      <van-nav-bar
        :title=props.title
        left-text=""
        right-text=""
        left-arrow
        @click-left="onClickLeft"
        @click-right="onClickRight"
      />
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from "vue-router";
const router = useRouter();

// 接受父组件传递的数据
const props = defineProps({
  title: {
    type: String,
    default: "",
  },
});
const onClickLeft = () => {
//   返回上一级
  router.go(-1);
};
const onClickRight = () => {
  console.log("返回");
};
</script>

<style scoped lang="scss">
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
}
</style>